@using AspNetCoreMVC.Models
@model Product;
@{
    Layout=null;
}
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>新增或编辑</title>
    <style>
        #editDiv{
            border: 1px solid;
            width:300px;
        }
    </style>
</head>

<body>
    <div id="editDiv">
        <table>
            @if (Model==null)
            {
            <tr hidden>
                <td>Id</td>
                <td><input type="text" name="id" value="0"></td>
            </tr>
            <tr>
                <td>商品名称</td>
                <td><input type="text" name="productName" value=""></td>
            </tr>
            <tr>
                <td>供应商名称</td>
                <td><input type="text" name="supplier" value=""></td>
            </tr>
            <tr>
                <td>价格</td>
                <td><input type="text" name="price" value=""></td>
            </tr>
            <tr>
                <td>数据库存</td>
                <td><input type="text" name="stock" value=""></td>
            </tr>
            <tr>
                <td>备注</td>
                <td><input type="text" name="remarks" value=""></td>
            </tr>
            <tr>
                <td><input id="btnSave" type="button" value="保存"></td>
                <td><input id="btnCancel" type="button" value="取消并返回列表"></td>
            </tr>
            }else{
            <tr hidden>
                <td>Id</td>
                <td><input type="text" name="id" value="@Model.Id"></td>
            </tr>
            <tr>
                <td>商品名称</td>
                <td><input type="text" name="productName" value="@Model.ProductName"></td>
            </tr>
            <tr>
                <td>供应商名称</td>
                <td><input type="text" name="supplier" value="@Model.Supplier"></td>
            </tr>
            <tr>
                <td>价格</td>
                <td><input type="text" name="price" value="@Model.Price"></td>
            </tr>
            <tr>
                <td>数据库存</td>
                <td><input type="text" name="stock" value="@Model.Stock"></td>
            </tr>
            <tr>
                <td>备注</td>
                <td><input type="text" name="remarks" value="@Model.Remarks"></td>
            </tr>
            <tr>
                <td><input id="btnSave" type="button" value="保存"></td>
                <td><input id="btnCancel" type="button" value="取消并返回列表"></td>
            </tr>
            }
        </table>
    </div>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
    <script src="~/js/base.js"></script>
</body>

</html>